
// import oimo.common.Mat3;
// import oimo.common.Vec3;

import { Vec3 } from "../../common/Vec3";
import { Mat3 } from "../../common/Mat3";
import { RigidBodyType } from "./RigidBodyType";

/**
 * A rigid body configuration is used for constructions of rigid bodies. An instance of this
 * class can safely be reused, as a rigid body will not have any references to a field of
 * this class.
 */
export class RigidBodyConfig {
	/**
	 * The world position of the rigid body's center of gravity.
	 */
	position: Vec3;

	/**
	 * The rotation matrix of the rigid body.
	 */
	rotation: Mat3;

	/**
	 * The initial value of the rigid body's linear velocity.
	 */
	linearVelocity: Vec3;

	/**
	 * The initial value of the rigid body's angular velocity.
	 */
	angularVelocity: Vec3;

	/**
	 * The rigid body's motion type. See `RigidBodyType` for details.
	 */
	type: number;

	/**
	 * Whether to automatically sleep the rigid body when it stops moving
	 * for a certain period of time, namely `Setting.sleepingTimeThreshold`.
	 */
	autoSleep: boolean;

	/**
	 * The damping coefficient of the linear velocity. Set positive values to
	 * gradually reduce the linear velocity.
	 */
	linearDamping: number;

	/**
	 * The damping coefficient of the angular velocity. Set positive values to
	 * gradually reduce the angular velocity.
	 */
	angularDamping: number;

	/**
	 * Default constructor.
	 */
	constructor() {
		this.position = new Vec3();
		this.rotation = new Mat3();
		this.linearVelocity = new Vec3();
		this.angularVelocity = new Vec3();
		this.type = RigidBodyType.DYNAMIC;
		this.autoSleep = true;
		this.linearDamping = 0;
		this.angularDamping = 0;
	}
}
